<?php
	/**
	* Product Manager
	* @author: trungdt
	* @since: Sep 26, 2011
	* @version: 1.0
	* 
	*  
	* Change logs
	* Sep 26, 2011 - trungdt - First create
	*/
	if (!defined('EXPONENT')) exit('');

	// Administrator access restrict
	if (exponent_users_isAdmin() || exponent_permissions_check(array('administrate', "configure", "create", "edit", "delete"),$loc))
	{
		exponent_flow_set(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);

		// passing param to build form
		$lang=exponent_lang_loadFile("modules/productsmodule/common.php");
		$admin_permission=false;
		if (exponent_permissions_check(array('administrate','configure'), $loc))
			$admin_permission=true;

		// product state
		$product_state=array();
		for ($i=0;$i<$lang['product_state_count'];$i++)
		{
			$product_state[$i]=$lang["product_state{$i}"];
		}

		// product state2
		$product_state2=array();
		for ($i=0;$i<$lang['product_state_2_count'];$i++)
		{
			$product_state2[$i]=$lang["product_state_2_{$i}"];
		}

		// public state
		$public_state=array();
		for ($i=0;$i<$lang['product_public_state_count'];$i++)
		{
			$public_state[$i]=$lang["product_public_state_{$i}"];
		}

		$template=new template("productsmodule","_ProductManager",$loc);
		$template->register_permissions(array('administrate', "configure", "create", "edit", "delete"),$loc);
		$template->assign('admin_permission',$admin_permission);
		$template->assign('product_state2',$product_state2);
		$template->assign('product_state',$product_state);
		$template->assign('public_state',$public_state);
		
		$template->output();
	}
	else
	{
		exponent_flow_redirect();
	}
?>
